<div class="edit-tab-with-sidemenu">
	<aside class="edit-sidemenu-aside">
		<ul class="edit-sidemenu">
			<li ng-class="{active: ctrl.subTabIndex === 0}">
				<a ng-click="ctrl.subTabIndex = 0">绘图选项</a>
			</li>
			<li ng-class="{active: ctrl.subTabIndex === 1}">
				<a ng-click="ctrl.subTabIndex = 1">
          序列覆盖 <span class="muted">({{ctrl.panel.seriesOverrides.length}})</span>
				</a>
			</li>
			<li ng-class="{active: ctrl.subTabIndex === 2}">
				<a ng-click="ctrl.subTabIndex = 2">
          阈值 <span class="muted">({{ctrl.panel.thresholds.length}})</span>
				</a>
			</li>
		</ul>
	</aside>

	<div class="edit-tab-content" ng-if="ctrl.subTabIndex === 0">
		<div class="section gf-form-group">
			<h5 class="section-heading">绘图模式</h5>
			<gf-form-switch class="gf-form" label="长块" label-class="width-5" checked="ctrl.panel.bars" on-change="ctrl.render()"></gf-form-switch>
			<gf-form-switch class="gf-form" label="线条" label-class="width-5" checked="ctrl.panel.lines" on-change="ctrl.render()"></gf-form-switch>
			<gf-form-switch class="gf-form" label="点" label-class="width-5" checked="ctrl.panel.points" on-change="ctrl.render()"></gf-form-switch>
		</div>
		<div class="section gf-form-group">
			<h5 class="section-heading">模式选项</h5>
			<div class="gf-form">
				<label class="gf-form-label width-8">填充</label>
				<div class="gf-form-select-wrapper max-width-5">
					<select class="gf-form-input" ng-model="ctrl.panel.fill" ng-options="f for f in [0,1,2,3,4,5,6,7,8,9,10]" ng-change="ctrl.render()" ng-disabled="!ctrl.panel.lines"></select>
				</div>
			</div>
			<div class="gf-form">
				<label class="gf-form-label width-8">行宽</label>
				<div class="gf-form-select-wrapper max-width-5">
					<select class="gf-form-input" ng-model="ctrl.panel.linewidth" ng-options="f for f in [0,1,2,3,4,5,6,7,8,9,10]" ng-change="ctrl.render()" ng-disabled="!ctrl.panel.lines"></select>
				</div>
			</div>
			<gf-form-switch ng-disabled="!ctrl.panel.lines" class="gf-form" label="楼梯" label-class="width-8" checked="ctrl.panel.steppedLine" on-change="ctrl.render()">
			</gf-form-switch>
			<div class="gf-form">
				<label class="gf-form-label width-8">点半径</label>
				<div class="gf-form-select-wrapper max-width-5">
					<select class="gf-form-input" ng-model="ctrl.panel.pointradius" ng-options="f for f in [0.5,1,2,3,4,5,6,7,8,9,10]" ng-change="ctrl.render()" ng-disabled="!ctrl.panel.points"></select>
				</div>
			</div>
		</div>
		<div class="section gf-form-group">
			<h5 class="section-heading">悬停工具提示</h5>
			<div class="gf-form">
				<label class="gf-form-label width-9">模式</label>
				<div class="gf-form-select-wrapper max-width-8">
					<select class="gf-form-input" ng-model="ctrl.panel.tooltip.shared" ng-options="f.value as f.text for f in [{text: '所有序列', value: true}, {text: '单个', value: false}]" ng-change="ctrl.render()"></select>
				</div>
			</div>
			<div class="gf-form">
				<label class="gf-form-label width-9">排序</label>
				<div class="gf-form-select-wrapper max-width-8">
					<select class="gf-form-input" ng-model="ctrl.panel.tooltip.sort" ng-options="f.value as f.text for f in [{text: '没有', value: 0}, {text: '递增', value: 1}, {text: '递减', value: 2}]" ng-change="ctrl.render()"></select>
				</div>
			</div>
			<div class="gf-form" ng-show="ctrl.panel.stack">
				<label class="gf-form-label width-9">堆栈值</label>
				<div class="gf-form-select-wrapper max-width-8">
					<select class="gf-form-input" ng-model="ctrl.panel.tooltip.value_type" ng-options="f for f in ['cumulative','individual']" ng-change="ctrl.render()"></select>
				</div>
			</div>
		</div>

		<div class="section gf-form-group">
			<h5 class="section-heading">堆栈 & Null 值</h5>
			<gf-form-switch class="gf-form" label="堆栈" label-class="width-7" checked="ctrl.panel.stack" on-change="ctrl.refresh()">
			</gf-form-switch>
			<gf-form-switch class="gf-form" ng-show="ctrl.panel.stack" label="百分比" label-class="width-7" checked="ctrl.panel.percentage" on-change="ctrl.render()">
			</gf-form-switch>
			<div class="gf-form">
				<label class="gf-form-label width-7">Null 值</label>
				<div class="gf-form-select-wrapper">
					<select class="gf-form-input max-width-9" ng-model="ctrl.panel.nullPointMode" ng-options="k as v for (k,v) in {'connected':'连接的', 'null':'null', 'null as zero':'null 为零'}" ng-change="ctrl.render()"></select>
				</div>
			</div>
		</div>
	</div>

	<div class="edit-tab-content" ng-if="ctrl.subTabIndex === 1">
		<div class="gf-form-group">
			<h5>序列特定的覆盖 <tip>正则表达式匹配示例： /server[0-3]/i </tip></h5>
			<div class="gf-form-inline" ng-repeat="override in ctrl.panel.seriesOverrides" ng-controller="SeriesOverridesCtrl">
				<div class="gf-form">
					<label class="gf-form-label">别名或正则表达式</label>
				</div>
				<div class="gf-form width-15">
					<input type="text" ng-model="override.alias" bs-typeahead="getSeriesNames" ng-blur="ctrl.render()" data-min-length=0 data-items=100 class="gf-form-input width-15">
				</div>
				<div class="gf-form" ng-repeat="option in currentOverrides">
					<label class="gf-form-label">
						<i class="pointer fa fa-remove" ng-click="removeOverride(option)"></i>
						<span ng-show="option.propertyName === 'color'">
							颜色：<i class="fa fa-circle" ng-style="{color:option.value}"></i>
						</span>
						<span ng-show="option.propertyName !== 'color'">
							{{option.name}}: {{option.value}}
						</span>
					</label>
				</div>

				<div class="gf-form">
					<span class="dropdown" dropdown-typeahead="overrideMenu" dropdown-typeahead-on-select="setOverride($item, $subItem)">
					</span>
				</div>

				<div class="gf-form gf-form--grow">
					<div class="gf-form-label gf-form-label--grow"></div>
				</div>

				<div class="gf-form">
					<label class="gf-form-label">
						<i class="fa fa-trash pointer" ng-click="ctrl.removeSeriesOverride(override)"></i>
					</label>
				</div>
			</div>
		</div>

		<button class="btn btn-inverse" ng-click="ctrl.addSeriesOverride()">
			<i class="fa fa-plus"></i>&nbsp;添加覆盖
		</button>
	</div>

	<div class="edit-tab-content" ng-if="ctrl.subTabIndex === 2">
		<graph-threshold-form panel-ctrl="ctrl"></graph-threshold-form>
	</div>

</div>
